<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <link rel="stylesheet" href="css/sidebar.css">
<%@ page import="org.hibernate.SessionFactory"%>
<%@ page import="org.hibernate.Session"%>
<%@ page import="java.util.List"%>
<%@ page import="hibernate.model.*"%>
<%@ page import="hibernate.util.HibernateUtil"%>
<%@ page import="hibernate.method.*"%>
<%@ page import="hibernate.method.UserMethods"%>

<div class="events">

	<div style="text-align:center">
		<div class="title">
			<h3>WYDARZENIA</h3>
		</div>
	</div>
<%
Integer user_id = (Integer) session.getAttribute("user_id");
response.setContentType("text/html");
SessionFactory sessionFactory = HibernateUtil.getSessionAnnotationFactory();
Session s= sessionFactory.openSession();
s.beginTransaction();
UserMethods um = new UserMethods();
if (user_id == null) {
%>
<div id="events_content">Aby wyswietlic znajomych musisz byc zalogowany</div>
		<% } 

else
	if ("client".equals(um.getUserType(sessionFactory, s, user_id))){
%>
	<div class="menu_simple">
		<ul>
			<li><a class="newEvent" href="index.jsp?page=events&group=newEvent">NOWY EVENT</a></li>
			<li><a class="takePart" href="index.jsp?page=events&group=takePart">BIORE UDZIAL</a></li>
			<li><a class="proposition" href="index.jsp?page=events&group=proposition">PROPOZYCJE</a></li>
			<li><a class="organizeByMe" href="index.jsp?page=events&group=organizeByMe">ORGANIZOWANE PRZEZE MNIE</a></li>
			<li><a class="all" href="index.jsp?page=events&group=all">WSZYSTKIE</a></li>
		</ul>
	</div>

	<div id="events_content">
<jsp:include page="events/events_content.jsp"></jsp:include>
</div>
<%} s.getTransaction().commit(); %>
</div>